﻿@{
    Layout = "~/Views/Shared/_Index.cshtml";
}
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment HostingEnvironment
@section header{
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/shris/js/vue.js"))
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/shris/css/element-index.css"))
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/shris/js/element-index.js"))
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/shris/js/axios.js"))
}
<div class="container-div" id="productionDetails-vue" style="margin-bottom:200px">
    <div class="header-info">
        <h1>头部基本信息区</h1>
    </div>
    <div class="table-p">
        <el-table :data="tableData"
                  style="width: 100%"
                  border>
            <el-table-column type="index"
                             label="序号">
            </el-table-column>
            <el-table-column prop="StationName"
                             label="工位名称">
            </el-table-column>
            <el-table-column prop="DeviceCode"
                             label="设备编码">
            </el-table-column>
            <el-table-column prop="DeviceName"
                             label="设备名称">
            </el-table-column>
            <el-table-column prop="ActionMode"
                             label="操作类型">
            </el-table-column>
            <el-table-column prop="Program"
                             label="程序号">
            </el-table-column>
            <el-table-column prop="UpdateTime"
                             label="操作时间">
            </el-table-column>
            <el-table-column label="详情" fixed="right">
                <template slot-scope="scope">
                    <a v-on:click="showMoreDetails(scope.row)">查看</a>
                </template>
            </el-table-column>
        </el-table>
    </div>
</div>
<script>
    let app = new Vue({
        el: '#productionDetails-vue',
        data: {
            ProductionCode: '',
            OrderCode: '',
            tableData:[]
        },
        methods: {
            // 初始化数据
            InitData() {
                let url = '@Url.Content("~/OrderManage/OrderPreview/GetProductionUrlDetails")'
                axios.get(url, {
                    params: {
                        orderCode: this.OrderCode,
                        productionId: this.ProductionCode
                    }
                }).then(res => {
                    let data = res.data;
                    this.tableData = [];
                    for (let production of data.productionInfo) {
                        let child = {
                            DeviceCode: production.DeviceCode,
                            StationName: production.ProductionId,
                            DeviceName: production.DeviceCode,
                            ActionMode: production.ActionMode,
                            Program: production.Program,
                            UpdateTime: production.UpdateTime
                        }
                        this.tableData.push(child)
                    }
                }).catch(err => {
                    console.log(err)
                })
            },
            showMoreDetails(row) {
                this.$notify({
                    title: '提示',
                    message: '该功能正在开发中！~~~',
                    type: 'success'
                });
            }
        },
        mounted() {
            let nav_a_info = window.parent.document.getElementById("productionURL")
            let productionCode = nav_a_info.getAttribute("productionCode")
            this.ProductionCode = productionCode.split('-连接-')[0];
            this.OrderCode = productionCode.split('-连接-')[1];
            this.InitData()
        }
    })
</script>

